﻿using System.Data.EntityClient;
using MicropleSoft.WmsServiceLibrary.DataSets;
using MicropleSoft.WmsServiceLibrary.Domain;
using MicropleSoft.WmsServiceLibrary.Sequence;
using MicropleSoft.WmsServiceLibrary.SqlServer;
using MicropleSoft.WmsServiceLibrary.SqlServer.Factory;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;

namespace MicropleSoft.WmsServiceLibrary.ServiceFactory
{
    public partial class SqlServerServiceFactory : AbstractServiceFactory
    {
        private readonly string _connectionString = string.Empty;
        public SqlServerServiceFactory()
        {
            var ctx = SqlServerModelFactory.Create();
            _connectionString = ((EntityConnection)ctx.Connection).StoreConnection.ConnectionString;
        }

        public override IDataTablePersist CreateDataTablePersist()
        {
            return new DataTablePersist();
        }

        public override ISequenceGenerator CreateSequenceGenerator()
        {
            return new SequenceGenerator();
        }

        public override Microsoft.Practices.EnterpriseLibrary.Data.Database CreateDatabase()
        {
            return new SqlDatabase(_connectionString);
        }

        public override  IDataTableWrapHandler CreateDataTableWrapHandler()
        {
            return new DataTableWrapHandler();
        }

        public override IDataTableFieldBuilder CreateDataTableFieldBuilder()
        {
            return new DataTableFieldBuilder();
        }

        public  override IDataSetPersist CreateDataSetPersist()
        {
            return new DataSetPersist();
        }

        public override IAreaService CreateAreaService()
        {
            return new AreaServiceSqlServer();
        }

        public override IAreaDetailService CreateAreaDetailService()
        {
            return new AreaDetailServiceSqlServer();
        }

        public override IFunctionGroupService CreateFunctionGroupService()
        {
            return new FunctionGroupServiceSqlServer();
        }

        public override IFunctionListService CreateFunctionListService()
        {
            return new FunctionListServiceSqlServer();
        }

        public override IItemNodeService CreateItemNodeService()
        {
            return new ItemNodeServiceSqlServer();
        }

        public override ILocationService CreateLocationService()
        {
            return new LocationServiceSqlServer();
        }

        public override ILocationTemplateService CreateLocationTemplateService()
        {
            return new LocationTemplateServiceSqlServer();
        }

        public override IMenuListService CreateMenuListService()
        {
            return new MenuListServiceSqlServer();
        }

        public override IOrganizationService CreateOrganizationService()
        {
            return new OrganizationServiceSqlServer();
        }

        public override IPackService CreatePackService()
        {
            return new PackServiceSqlServer();
        }

        public override IRoleService CreateRoleService()
        {
            return new RoleServiceSqlServer();
        }

        public override IRoleFunctionService CreateRoleFunctionService()
        {
            return new RoleFunctionServiceSqlServer();
        }

        public override IRoleFunctionGroupService CreateRoleFunctionGroupService()
        {
            return new RoleFunctionGroupServiceSqlServer();
        }

        public override ISysLoginLogService CreateSysLoginLogService()
        {
            return new SysLoginLogServiceSqlServer();
        }

        public override ITranslationService CreateTranslationService()
        {
            return new TranslationServiceSqlServer();
        }

        public override IUserRoleService CreateUserRoleService()
        {
            return new UserRoleServiceSqlServer();
        }

        public override IUserTokenListService CreateUserTokenListService()
        {
            return new UserTokenListServiceSqlServer();
        }

        public override IUserWhService CreateUserWhService()
        {
            return new UserWhServiceSqlServer();
        }

        public override IWhConfigService CreateWhConfigService()
        {
            return new WhConfigServiceSqlServer();
        }

        public override IWmsUserService CreateWmsUserService()
        {
            return new WmsUserServiceSqlServer();
        }

        public override IZoneService CreateZoneService()
        {
            return new ZoneServiceSqlServer();
        }


        public override IBillClassService CreateBillClassService()
        {
            return new BillClassServiceSqlServer();
        }

        public override IBillTemplateService CreateBillTemplateService()
        {
            return new BillTemplateServiceSqlServer();
        }

        public override IBillTemplateEntryService CreateBillTemplateEntryService()
        {
            return new BillTemplateEntryServiceSqlServer();
        }

        public override IItemClassService CreateItemClassService()
        {
            return new ItemClassServiceSqlServer();
        }

        public override IItemTemplateService CreateItemTemplateService()
        {
            return new ItemTemplateServiceSqlServer();
        }

        public override IItemClassKindService CreateItemClassKindService()
        {
            return new ItemClassKindServiceSqlServer();
        }



        public override IBillingEntityService CreateBillingEntityService()
        {
            return new BillingEntityServiceSqlServer();
        }

        public override ICarrierService CreateCarrierService()
        {
            return new CarrierServiceSqlServer();
        }

        public override ICustomerService CreateCustomerService()
        {
            return new CustomerServiceSqlServer();
        }

        public override IOwnerService CreateOwnerService()
        {
            return new OwnerServiceSqlServer();
        }

        public override IVendorService CreateVendorService()
        {
            return new VendorServiceSqlServer();
        }



        public override IPurchaseOrderService CreatePurchaseOrderService()
        {
            return new PurchaseOrderServiceSqlServer();
        }

        public override IPurchaseOrderDetailService CreatePurchaseOrderDetailService()
        {
            return new PurchaseOrderDetailServiceSqlServer();
        }

    }
}